package com.cloud.pole.shop.biz.goods;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.mapper.goods.ShopGoodsAttrMapper;
import com.cloud.pole.shop.model.entity.goods.ShopGoodsAttr;
import com.cloud.pole.shop.model.vo.goods.ShopGoodsAttrVo;

@Service
@Transactional(rollbackFor = Exception.class)
public class ShopGoodsAttrBiz extends BaseBiz<ShopGoodsAttrMapper, ShopGoodsAttr> {

	@Cache(key="shopGoodsAttrList{1}")
	public List<ShopGoodsAttrVo> selectListByGoodsId(Integer goodsId) {
		return mapper.selectListByGoodsId(goodsId);
	}
	
	@CacheClear(key= "shopGoodsAttrList{1.goodsId}")
	public void insertInGoodsAttr(ShopGoodsAttr shopGoodsAttrs) {
		mapper.add(shopGoodsAttrs);
	}
	
	public List<ShopGoodsAttr> selectByGoodsAttr(Integer goodsId){
		return mapper.selectByGoodsByAttr(goodsId);
	}
	
	@CacheClear(key= "shopGoodsAttrList{1}")
	public void delete(Integer goodsId) {
		mapper.deleteByGoodsIdAll(goodsId);
	}
}
